package org.deadline.service.baseapp;

import java.util.List;
import org.deadline.model.baseapp.ApplicationLog;
import org.deadline.repository.baseapp.ApplicationLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class ApplicationLogServiceImpl implements ApplicationLogService {

	@Autowired
    ApplicationLogRepository applicationLogRepository;

	public long countAllApplicationLogs() {
        return applicationLogRepository.count();
    }

	public void deleteApplicationLog(ApplicationLog applicationLog) {
        applicationLogRepository.delete(applicationLog);
    }

	public ApplicationLog findApplicationLog(Long id) {
        return applicationLogRepository.findOne(id);
    }

	public List<ApplicationLog> findAllApplicationLogs() {
        return applicationLogRepository.findAll();
    }

	public List<ApplicationLog> findApplicationLogEntries(int firstResult, int maxResults) {
        return applicationLogRepository.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
    }

	public void saveApplicationLog(ApplicationLog applicationLog) {
        applicationLogRepository.save(applicationLog);
    }

	public ApplicationLog updateApplicationLog(ApplicationLog applicationLog) {
        return applicationLogRepository.save(applicationLog);
    }
}
